package com.yy.web.pm.until;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(UserNotFoundException.class)
    public ResponseEntity<Result<?>> handleUserNotFoundException(UserNotFoundException ex) {
        // 返回 404 状态码和错误信息
        return ResponseEntity.status(HttpStatus.OK)
                .body(Result.error(HttpStatus.OK.value(), ex.getMessage()));
    }
}
